Skip to content

Add a check for migration ordering - #582

Merged
chiragjn merged 2 commits into
mainfrom
cj-check-migrations-order
Sep 3, 2026
Merged

chiragjn merged 2 commits into
mainfrom
cj-check-migrations-order

Conversation

@chiragjn

@chiragjn chiragjn commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Note

Low Risk
CI-only guardrail with no runtime or schema behavior changes; low risk aside from PRs that add out-of-order migrations now failing until filenames are fixed.

Overview
Adds a Migration Order CI job that runs on every PR before the aggregate check can pass. It deep-checks out the repo, fetches main, and runs scripts/check-migration-order.sh.

The new script compares newly added files under packages/trueforge/src/db/postgres/migrations and sqlite/migrations against the lexicographically latest migration already on origin/main (override base via MIGRATION_BASE_REF). If any added migration filename sorts at or before that baseline, the job fails with a list of invalid names; PRs with no new migrations exit successfully.

The final check job now requires migration-order to succeed alongside existing gates.

Reviewed by Cursor Bugbot for commit 9ddb5d5. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9ddb5d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4135efa. Configure here.

@chiragjn
chiragjn force-pushed the cj-check-migrations-order branch from 8d339d9 to 9ddb5d5 Compare September 3, 2026 18:04
@chiragjn
chiragjn merged commit 284762f into main Sep 3, 2026
10 checks passed
@chiragjn
chiragjn deleted the cj-check-migrations-order branch September 3, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant